package com.whz.governance.redislimiter;

import com.whz.generic.spring.SpringUtils;
import org.springframework.core.env.Environment;

/**
 * @author whz
 */
public final class RedisConstants {
    public static final String PREFIX = "generic:tools:" + currentServiceName() + ':';

    private RedisConstants() {
    }

    public static String currentServiceName() {
        return SpringUtils.getBean(Environment.class)
                          .map(env -> env.getProperty("spring.application.name"))
                          .orElse("defaut");
    }
}